import Vue from 'vue'
import App from './App.vue'
import echarts from 'echarts'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import router from './router'

import axios from 'axios'

import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
Vue.use(mavonEditor);

Vue.use(ElementUI);
Vue.use(router);
axios.defaults.baseURL = "http://localhost:9999";
Vue.prototype.$http = axios;
Vue.prototype.$echarts = echarts;

axios.interceptors.request.use(config => {
	config.headers.token = window.sessionStorage.getItem('token');
	return config;
})

/* // 添加响应拦截器
axios.interceptors.response.use((res) => {
	if (res.data.code == 401) {
		router.replace("/login");
	} else if (res.data.code == 500) {
	}
	return res;
}); */

Vue.config.productionTip = false;

new Vue({
	render: h => h(App),
	router
}).$mount('#app')
